package com.fdm.model.properties;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class AccountBuilderProperties 
{
	private Properties properties = new Properties();
	private final static String file = "BankTeller.properties";
	
	public AccountBuilderProperties() {
		
		ReadFile(file);
	}
	
	public String [] getDecorations(String accountType)
	{
		String decorators = (String) properties.get(accountType);
		String [] decoratorArray = decorators.split(":");
		int length = decoratorArray.length;
		String [] decorationClasses = new String [length];
		for (int i=0; i<length; i++)
		{
			decorationClasses[i] = properties.getProperty(decoratorArray[i]);
		}
		return decorationClasses;
	}
	
	private void ReadFile(String file)
	{
		try {
			InputStream inputStream = this.getClass().getClassLoader()  
	        .getResourceAsStream(file); 
			if (inputStream!=null) properties.load(inputStream);
		} catch (FileNotFoundException e) {

		} catch (IOException e) {

		}
	}
}
